feat(rpc): add tempo_simulateV1 with TIP-20 token metadata enrichment#3449
Merged
feat(rpc): add tempo_simulateV1 with TIP-20 token metadata enrichment#3449
Conversation
Adds `tempo_simulateV1` RPC method that wraps standard `eth_simulateV1` and enriches the response with TIP-20 token metadata (name, symbol, decimals, currency) for all tokens appearing in Transfer event logs. Eliminates the second roundtrip the wallet needs to fetch token info after simulation. Co-authored-by: Georgios Konstantopoulos <17802178+gakonst@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d5428-5f7d-7428-ad0e-ab26a32589b2
Pre-extract TIP-20 addresses from request call targets and resolve metadata concurrently with the simulation via tokio::join!. Only tokens that appear in simulation logs but weren't in the prefetched set trigger a second (small) metadata lookup. Co-Authored-By: Georgios Konstantopoulos <17802178+gakonst@users.noreply.github.com>
Decimals are always 6 for TIP-20 tokens — no need to read from storage. Co-Authored-By: Georgios Konstantopoulos <17802178+gakonst@users.noreply.github.com>
0xKitsune
reviewed
Apr 3, 2026
- Use tempo_contracts::precompiles::DECIMALS instead of local const - Move decimals to top-level response (constant across all TIP-20 tokens) - Use HashSet for extra token addresses instead of Vec + sort/dedup Co-Authored-By: 0xKitsune <77890308+0xKitsune@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d54e7-2118-72eb-aa66-24969aad6efc
tempo-contracts was only in dev-dependencies — moved to dependencies so tempo_contracts::precompiles::DECIMALS resolves. Merged duplicate reth_provider imports for nightly fmt. Co-authored-by: 0xKitsune <77890308+0xKitsune@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d54e7-2118-72eb-aa66-24969aad6efc
0xKitsune
approved these changes
Apr 3, 2026
Comment on lines
+50
to
+51
| #[serde(with = "alloy_serde::quantity")] | ||
| pub decimals: u8, |
Contributor
There was a problem hiding this comment.
Do we need to include decimals if this is always 6 decimals for all TIP20s?
0xKitsune
requested changes
Apr 3, 2026
Uses state_at_block_id_or_latest(block) instead of latest_state() so token metadata is read from the same block the simulation targets. Derives hardfork spec from the target block's timestamp instead of u64::MAX. Co-authored-by: 0xKitsune <77890308+0xKitsune@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d54e7-2118-72eb-aa66-24969aad6efc
0xKitsune
approved these changes
Apr 3, 2026
mattsse
reviewed
Apr 4, 2026
Contributor
mattsse
left a comment
There was a problem hiding this comment.
just for obtaining
"0x20c0...": {
"name": "Path USD",
"symbol": "pUSD",
"decimals": 6,
"currency": "USD"
}
this doesnt really make a lot of sense imo, because all of these are immutable, so it would make more sense to cache these client side imo
klkvr
reviewed
Apr 4, 2026
Contributor
|
Can we figure out a way to merge this in with or without cache by Monday EOD? Impacts wallet performance, I understand the concern that we should just cache it if u guys can take it over |
klkvr
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
tempo_simulateV1RPC method that wrapseth_simulateV1and enriches the response with TIP-20 token metadata (name, symbol, decimals, currency) for all tokens appearing in Transfer event logs. This eliminates the second roundtrip the wallet app needs to fetch token symbols/decimals after simulation.The wallet currently calls
eth_simulateV1withtraceTransfers: trueto get balance diffs as synthetic Transfer logs, then makes separate calls for each token's metadata.tempo_simulateV1returns both in a single response:{ "blocks": [ /* standard eth_simulateV1 blocks */ ], "tokenMetadata": { "0x20c0...": { "name": "Path USD", "symbol": "pUSD", "decimals": 6, "currency": "USD" } } }Callable from viem as
client.request({ method: 'tempo_simulateV1', params: [...] }).Prompted by: georgios